layui.use(['jquery', 'form', 'common', 'upload'], function() {
	var $ = layui.jquery;
	var form = layui.form;
	var common = layui.common;
	var upload = layui.upload;

	form.on('submit(form)', function(data) {
		$.post('save', data.field, function(data) {
			if (data.state == 'ok') {
				// 成功，跳转到列表页面
				common.toUrl('list');
			} else {
				// 失败，弹出提示
				layer.msg(data.msg, {
					icon: 5,
					anim: 6
				});
			}
		});
		return false;
	});
	upload.render(common.uploadImageOption('image'));
});